home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / C Internet Config / Examples ƒ / Example / IC Headers ƒ / IC API Descriptions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-17  |  21.4 KB  |  523 lines  |  [TEXT/SPM ]

  1. /*
  2.     IC API Descriptions.h
  3.     
  4.     Describes each of the functions for the IC routines.
  5.     
  6. */
  7.  
  8. #if 0
  9.  
  10. /* ***** Starting Up and Shutting Down ***** */
  11.  
  12. ICError ICStart(ICInstance* inst,OSType creator);
  13. /*
  14.     Call this at application initialisation. Set creator to your application
  15.     creator to allow for future expansion of the IC system. Returns
  16.     inst as a connection to the IC system.
  17. */
  18.  
  19. ICError ICStop(ICInstance inst);
  20. /*
  21.     It is illegal to call this routine inside a ICBegin/End pair.
  22.     Call this at application initialisation, after which inst
  23.     is no longer valid connection to IC.
  24. */
  25.  
  26. /* ***** Specifying a Configuration ***** */
  27.  
  28. ICError ICFindConfigFile(ICInstance inst,short count,ICDirSpecArrayPtr folders);
  29. /*
  30.     It is illegal to call this routine inside a ICBegin/End pair.
  31.     Call to configure this connection to IC.
  32.     Set count as the number of valid elements in folders.
  33.     Set folders to a pointer to the folders to search.
  34.     Setting count to 0 and folders to nil is OK.
  35.     Searches the specified folders and then the Preferences folder
  36.     in a unspecified manner.
  37. */
  38.  
  39. ICError ICFindUserConfigFile(ICInstance inst,ICDirSpec* where);
  40. /*
  41.     Requires IC 1.1.
  42.     It is illegal to call this routine inside a ICBegin/End pair.
  43.     Similar to ICFindConfigFile except that it only searches the folder
  44.     specified in where.  If the input parameters are valid the routine
  45.     will always successful configure the instance, creating an
  46.     empty configuration if necessary
  47.     For use with double-clickable preference files.
  48. */
  49.  
  50. ICError ICGeneralFindConfigFile(ICInstance inst,Boolean search_prefs,Boolean can_create,short count,ICDirSpecArrayPtr folders);
  51. /*
  52.     Requires IC 1.2.
  53.     It is illegal to call this routine inside a ICBegin/End pair.
  54.     Call to configure this connection to IC.
  55.     This routine acts as a more general replacement for
  56.     ICFindConfigFile and ICFindUserConfigFile.
  57.     Set search_prefs to true if you want it to search the preferences folder.
  58.     Set can_create to true if you want it to be able to create a new config.
  59.     Set count as the number of valid elements in folders.
  60.     Set folders to a pointer to the folders to search.
  61.     Setting count to 0 and folders to nil is OK.
  62.     Searches the specified folders and then optionally the Preferences folder
  63.     in a unspecified manner.
  64. */
  65.  
  66. ICError ICChooseConfig(ICInstance inst);
  67. /*
  68.     Requires IC 1.2.
  69.     It is illegal to call this routine inside a ICBegin/End pair.
  70.     Requests the user to choose a configuration, typically using some
  71.     sort of modal dialog. If the user cancels the dialog the configuration
  72.     state will be unaffected.
  73. */
  74.  
  75. ICError ICChooseNewConfig(ICInstance inst);
  76. /*
  77.     Requires IC 1.2.
  78.     It is illegal to call this routine inside a ICBegin/End pair.
  79.     Requests the user to create a new configuration, typically using some
  80.     sort of modal dialog. If the user cancels the dialog the configuration
  81.     state will be unaffected.
  82. */
  83.  
  84. ICError ICGetConfigName(ICInstance inst,Boolean longname,StringPtr name);
  85. /*
  86.     Requires IC 1.2.
  87.     You must specify a configuration before calling this routine.
  88.     Returns a string that describes the current configuration at a user
  89.     level. Set longname to true if you want a long name, up to 255
  90.     characters, or false if you want a short name, typically about 32
  91.     characters.
  92.     The returned string is for user display only. If you rely on the
  93.     exact format of it, you will conflict with any future IC
  94.     implementation that doesn't use explicit preference files.
  95. */
  96.  
  97. ICError ICGetConfigReference(ICInstance inst,ICConfigRefHandle ref);
  98. /*
  99.     Requires IC 1.2.
  100.     You must specify a configuration before calling this routine.
  101.     Returns a self-contained reference to the instance's current
  102.     configuration.
  103.     ref must be a valid non-nil handle and it will be resized to fit the
  104.     resulting data.
  105. */
  106.  
  107. ICError ICSetConfigReference(ICInstance inst,ICConfigRefHandle ref,long flags);
  108. /*
  109.     Requires IC 1.2.
  110.     It is illegal to call this routine inside a ICBegin/End pair.
  111.     Reconfigures the instance using a configuration reference that was
  112.     got using ICGetConfigReference reference. Set the
  113.     icNoUserInteraction_bit in flags if you require that this routine
  114.     not present a modal dialog. Other flag bits are reserved and should
  115.     be set to zero.
  116.     ref must not be nil.
  117. */
  118.  
  119. ICError ICSpecifyConfigFile(ICInstance inst,FSSpec* config);
  120. /*
  121.     It is illegal to call this routine inside a ICBegin/End pair.
  122.     For use only by the IC application.
  123.     If you call this routine yourself, you will conflict with any
  124.     future IC implementation that doesn't use explicit preference files.
  125. */
  126.  
  127. /* ***** Getting Information ***** */
  128.  
  129. ICError ICGetSeed(ICInstance inst,long* seed);
  130. /*
  131.     You do not have to specify a configuration before calling this routine.
  132.     You do not have to be inside an ICBegin/End pair to call this routine.
  133.     Returns the current seed for the IC prefs database.
  134.     This seed changes each time a non-volatile preference is changed.
  135.     You can poll this to determine if any cached preferences change.
  136. */
  137.  
  138. ICError ICGetPerm(ICInstance inst,ICPerm* perm);
  139. /*
  140.     You do not have to specify a configuration before calling this routine.
  141.     Returns the access permissions currently associated with this instance.
  142.     While applications normally know what permissions they have,
  143.     this routine is designed for use by override components.
  144. */
  145.  
  146. ICError ICDefaultFileName(ICInstance inst,StringPtr name);
  147. /*
  148.     You do not have to specify a configuration before calling this routine.
  149.     You do not have to be inside an ICBegin/End pair to call this routine.
  150.     Returns the default file name for IC preference files.
  151.     Applications should never need to call this routine.
  152.     If you rely on information returned by this routine yourself,
  153.     you may conflict with any future IC implementation that doesn't use
  154.     explicit preference files.
  155.     The component calls this routine to set up the default IC file name.
  156.     This allows this operation to be intercepted by a component that has
  157.     captured us. It currently gets it from the component resource file.
  158.     The glue version is hardwired to "Internet Preferences".
  159. */
  160.  
  161. ICError ICGetComponentInstance(ICInstance inst,Ptr* component_inst);
  162. /*
  163.     Requires IC 1.2.
  164.     You do not have to specify a configuration before calling this routine.
  165.     You do not have to be inside an ICBegin/End pair to call this routine.
  166.     Returns noErr and the connection to the IC component,
  167.     if we're using the component.
  168.     Returns badComponenInstance and nil if we're operating with glue.
  169.     The component_inst parameter is a universal pointer to avoid
  170.     us having to include Component.[ph] (which is not available under
  171.     some development environments) in order to use IC.
  172. */
  173.  
  174. /* ***** Reading and Writing Preferences ***** */
  175.  
  176. ICError ICBegin(ICInstance inst,ICPerm perm);
  177. /*
  178.     You must specify a configuration before calling this routine.
  179.     It is illegal to call this routine inside a ICBegin/End pair.
  180.     Starting reading or writing multiple preferences.
  181.     A call to this must be balanced by a call to ICEnd.
  182.     Do not call WaitNextEvent between these calls.
  183.     The perm specifies whether you intend to read or read/write.
  184.     Only one writer is allowed per instance.
  185.     Note that this may open resource files that are not closed
  186.     until you call ICEnd.
  187. */
  188.  
  189. ICError ICGetPref(ICInstance inst,StringPtr key,ICAttr* attr,Ptr buf,long* size);
  190. /*
  191.     You must specify a configuration before calling this routine.
  192.     If you are getting or setting multiple preferences, you should place
  193.     these calls within an ICBegin/ICEnd pair.
  194.     If you call this routine outside of such a pair, it implicitly
  195.     calls ICBegin(inst, icReadOnlyPerm).
  196.     Reads the preference specified by key from the IC database to the
  197.     buffer pointed to by buf and size.
  198.     key must not be the empty string.
  199.     If buf is nil then no data is returned.
  200.     size must be non-negative.
  201.     attr and size are always set on return. On errors (except icTruncatedErr)
  202.     attr is set to ICattr_no_change and size is set to 0.
  203.     size is the actual size of the data.
  204.     attr is set to the attributes associated with the preference.
  205.     If this routine returns icTruncatedErr then the other returned
  206.     values are valid except that only the first size bytes have been
  207.     return. size is adjusted to reflect the true size of the preference.
  208.     Returns icPrefNotFound if there is no preference for the key.
  209. */
  210.  
  211. ICError ICSetPref(ICInstance inst,StringPtr key,ICAttr attr,Ptr buf,long size);
  212. /*
  213.     You must specify a configuration before calling this routine.
  214.     If you are getting or setting multiple preferences, you should place
  215.     these calls within an ICBegin/ICEnd pair.
  216.     If you call this routine outside of such a pair, it implicitly
  217.     calls ICBegin(inst, icReadWritePerm).
  218.     Sets the preference specified by key from the IC database to the
  219.     value pointed to by buf and size.
  220.     key must not be the empty string.
  221.     size must be non-negative. 
  222.     If buf is nil then the preference value is not set and size is ignored.
  223.     If buf is not nil then the preference value is set to the size
  224.     bytes pointed to by buf.
  225.     If attr is ICattr_no_change then the preference attributes are not set.
  226.     Otherwise the preference attributes are set to attr.
  227.     Returns icPermErr if the previous ICBegin was passed icReadOnlyPerm.
  228.     Returns icPermErr if current attr is locked, new attr is locked and buf <> nil.
  229. */
  230.  
  231. ICError ICFindPrefHandle(ICInstance inst,StringPtr key,ICAttr* attr,Handle prefh);
  232. /*
  233.     Requires IC 1.2.
  234.     You must specify a configuration before calling this routine.
  235.     If you are getting or setting multiple preferences, you should place
  236.     these calls within an ICBegin/ICEnd pair.
  237.     If you call this routine outside of such a pair, it implicitly
  238.     calls ICBegin(inst, icReadWritePerm).
  239.     This routine effectively replaces ICGetPrefHandle.
  240.     Reads the preference specified by key from the IC database into
  241.     a handle, prefh.
  242.     key must not be the empty string.
  243.     attr is set to the attributes associated with the preference.
  244.     You must set prefh to a non-nil handle before calling this routine.
  245.     If the preference does not exist, icPrefNotFoundErr is returned.
  246. */
  247.  
  248. ICError ICGetPrefHandle(ICInstance inst,StringPtr key,ICAttr* attr,Handle* prefh);
  249. /*
  250.     Requires IC 1.1.
  251.     You must specify a configuration before calling this routine.
  252.     If you are getting or setting multiple preferences, you should place
  253.     these calls within an ICBegin/ICEnd pair.
  254.     If you call this routine outside of such a pair, it implicitly
  255.     calls ICBegin(inst, icReadOnlyPerm).
  256.     This routine is now obsolete. Use ICFindPrefHandle instead.
  257.     Reads the preference specified by key from the IC database into
  258.     a newly created handle, prefh.
  259.     key must not be the empty string.
  260.     attr is set to the attributes associated with the preference.
  261.     The incoming value of prefh is ignored.
  262.     A new handle is created in the current heap and returned in prefh.
  263.     If the routine returns an error, prefh is set to nil.
  264.     If the preference does not exist, no error is returned and prefh is set
  265.     to an empty handle.
  266. */
  267.  
  268. ICError ICSetPrefHandle(ICInstance inst,StringPtr key,ICAttr attr,Handle prefh);
  269. /*
  270.     Requires IC 1.1.
  271.     You must specify a configuration before calling this routine.
  272.     If you are getting or setting multiple preferences, you should place
  273.     these calls within an ICBegin/ICEnd pair.
  274.     If you call this routine outside of such a pair, it implicitly
  275.     calls ICBegin(inst, icReadWritePerm).
  276.     Sets the preference specified by key from the IC database to the
  277.     value contained in prefh.
  278.     key must not be the empty string.
  279.     If prefh is nil then the preference value is not set.
  280.     If buf is not nil then the preference value is set to the data
  281.     contained in it.
  282.     If attr is ICattr_no_change then the preference attributes are not set.
  283.     Otherwise the preference attributes are set to attr.
  284.     Returns icPermErr if the previous ICBegin was passed icReadOnlyPerm.
  285.     Returns icPermErr if current attr is locked, new attr is locked and prefh <> nil.
  286. */
  287.  
  288. ICError ICCountPref(ICInstance inst,long* count);
  289. /*
  290.     You must specify a configuration before calling this routine.
  291.     You must be inside an ICBegin/End pair to call this routine.
  292.     Counts the total number of preferences.
  293.     If the routine returns an error, count is set to 0.
  294. */
  295.  
  296. ICError ICGetIndPref(ICInstance inst,long n,StringPtr key);
  297. /*
  298.     You must specify a configuration before calling this routine.
  299.     You must be inside an ICBegin/End pair to call this routine.
  300.     Returns the key of the Nth preference.
  301.     n must be positive.
  302.     Returns icPrefNotFoundErr if n is greater than the total number of preferences.
  303.     If the routine returns an error, key is undefined.
  304. */
  305.  
  306. ICError ICDeletePref(ICInstance inst,StringPtr key);
  307. /*
  308.     You must specify a configuration before calling this routine.
  309.     You must be inside an ICBegin/End pair to call this routine.
  310.     Deletes the preference specified by key.
  311.     key must not be the empty string.
  312.     Returns icPrefNotFound if the preference specified by key is not present.
  313. */
  314.  
  315. ICError ICEnd(ICInstance inst);
  316. /*
  317.     You must specify a configuration before calling this routine.
  318.     You must be inside an ICBegin/End pair to call this routine.
  319.     Terminates a preference session, as started by ICBegin.
  320.     You must have called ICBegin before calling this routine.
  321. */
  322.  
  323. /* ***** User Interface Stuff ***** */
  324.  
  325. ICError ICEditPreferences(ICInstance inst,StringPtr key);
  326. /*
  327.     Requires IC 1.1.
  328.     You must specify a configuration before calling this routine.
  329.     You do not have to be inside an ICBegin/End pair to call this routine.
  330.     Instructs IC to display the user interface associated with editing
  331.     preferences and focusing on the preference specified by key.
  332.     If key is the empty string then no preference should be focused upon.
  333.     You must have specified a configuration before calling this routine.
  334.     You do not need to call ICBegin before calling this routine.
  335.     In the current implementation this launches the IC application
  336.     (or brings it to the front) and displays the window containing
  337.     the preference specified by key.
  338.     It may have a radically different implementation in future
  339.     IC systems.
  340. */
  341.  
  342. /* ***** URL Handling ***** */
  343.  
  344. ICError ICParseURL(ICInstance inst,StringPtr hint,Ptr data,long len,long* selStart,long* selEnd,Handle url);
  345. /*
  346.     Requires IC 1.1.
  347.     You must specify a configuration before calling this routine.
  348.     You do not have to be inside an ICBegin/End pair to call this routine.
  349.     Parses a URL out of the specified text and returns it in a canonical form
  350.     in a handle.
  351.     hint indicates the default scheme for URLs of the form "name@address".
  352.     If hint is the empty string then URLs of that form are not allowed.
  353.     data points to the start of the text. It must not be nil.
  354.     len indicates the length of the text. It must be non-negative.
  355.     selStart and selEnd should be passed in as the current selection of
  356.     the text. This selection is given in the same manner as TextEdit,
  357.     ie if selStart = selEnd then there is no selection only an insertion
  358.     point. Also selStart ≤ selEnd and 0 ≤ selStart ≤ len and 0 ≤ selEnd ≤ len.
  359.     selStart and selEnd are returned as the bounds of the URL. If the
  360.     routine returns an error then these new boundaries may be
  361.     invalid but they will be close.
  362.     The incoming url handle must not be nil.  The resulting URL is normalised
  363.     and copied into the url handle, which is resized to fit.
  364. */
  365.  
  366. ICError ICLaunchURL(ICInstance inst,StringPtr hint,Ptr data,long len,long* selStart,long* selEnd);
  367. /*
  368.     Requires IC 1.1.
  369.     You must specify a configuration before calling this routine.
  370.     You do not have to be inside an ICBegin/End pair to call this routine.
  371.     Parses a URL out of the specified text and feeds it off to the
  372.     appropriate helper.
  373.     hint indicates the default scheme for URLs of the form "name@address".
  374.     If hint is the empty string then URLs of that form are not allowed.
  375.     data points to the start of the text. It must not be nil.
  376.     len indicates the length of the text. It must be non-negative.
  377.     selStart and selEnd should be passed in as the current selection of
  378.     the text. This selection is given in the same manner as TextEdit,
  379.     ie if selStart = selEnd then there is no selection only an insertion
  380.     point. Also selStart ≤ selEnd and 0 ≤ selStart ≤ len and 0 ≤ selEnd ≤ len.
  381.     selStart and selEnd are returned as the bounds of the URL. If the
  382.     routine returns an error then these new boundaries may be
  383.     invalid but they will be close.
  384.     The URL is parsed out of the text and passed off to the appropriate
  385.     helper using the GURL AppleEvent.
  386. */
  387.  
  388. /* ***** Mappings Routines *****
  389.  * 
  390.  * Routines for interrogating mappings database.
  391.  * 
  392.  * ----- High Level Routines -----
  393.  */
  394.  
  395. ICError ICMapFilename(ICInstance inst,StringPtr filename,ICMapEntry* entry);
  396. /*
  397.     Requires IC 1.1.
  398.     You must specify a configuration before calling this routine.
  399.     If you are getting or setting multiple preferences, you should place
  400.     these calls within an ICBegin/ICEnd pair.
  401.     If you call this routine outside of such a pair, it implicitly
  402.     calls ICBegin(inst, icReadWritePerm).
  403.     Takes the name of an incoming file and returns the most appropriate
  404.     mappings database entry, based on its extension.
  405.     filename must not be the empty string.
  406.     Returns icPrefNotFoundErr if no suitable entry is found.
  407. */
  408.  
  409. ICError ICMapTypeCreator(ICInstance inst,OSType fType,OSType fCreator,StringPtr filename,ICMapEntry* entry);
  410. /*
  411.     Requires IC 1.1.
  412.     You must specify a configuration before calling this routine.
  413.     You must be inside an ICBegin/End pair to call this routine.
  414.     Takes the type and creator (and optionally the name) of an outgoing
  415.     file and returns the most appropriate mappings database entry.
  416.     The filename may be either the name of the outgoing file or
  417.     the empty string.
  418.     Returns icPrefNotFoundErr if no suitable entry found.
  419. */
  420.  
  421. /* ----- Mid Level Routines ----- */
  422.  
  423. ICError ICMapEntriesFilename(ICInstance inst,Handle entries,StringPtr filename,ICMapEntry* entry);
  424. /*
  425.     Requires IC 1.1.
  426.     You must specify a configuration before calling this routine.
  427.     You do not have to be inside an ICBegin/End pair to call this routine.
  428.     Takes the name of an incoming file and returns the most appropriate
  429.     mappings database entry, based on its extension.
  430.     entries must be a handle to a valid IC mappings database preference.
  431.     filename must not be the empty string.
  432.     Returns icPrefNotFoundErr if no suitable entry is found.
  433. */
  434.  
  435. ICError ICMapEntriesTypeCreator(ICInstance inst,Handle entries,OSType fType,OSType fCreator,StringPtr filename,ICMapEntry* entry);
  436. /*
  437.     Requires IC 1.1.
  438.     You must specify a configuration before calling this routine.
  439.     You do not have to be inside an ICBegin/End pair to call this routine.
  440.     Takes the type and creator (and optionally the name) of an outgoing
  441.     file and returns the most appropriate mappings database entry.
  442.     entries must be a handle to a valid IC mappings database preference.
  443.     The filename may be either the name of the outgoing file or
  444.     the empty string.
  445.     Returns icPrefNotFoundErr if no suitable entry found.
  446. */
  447.  
  448. /* ----- Low Level Routines ----- */
  449.  
  450. ICError ICCountMapEntries(ICInstance inst,Handle entries,long* count);
  451. /*
  452.     Requires IC 1.1.
  453.     You must specify a configuration before calling this routine.
  454.     You do not have to be inside an ICBegin/End pair to call this routine.
  455.     Counts the number of entries in the mappings database.
  456.     entries must be a handle to a valid IC mappings database preference.
  457.     count is set to the number of entries.
  458. */
  459.  
  460. ICError ICGetIndMapEntry(ICInstance inst,Handle entries,long ndx,long* pos,ICMapEntry* entry);
  461. /*
  462.     Requires IC 1.1.
  463.     You must specify a configuration before calling this routine.
  464.     You do not have to be inside an ICBegin/End pair to call this routine.
  465.     Gets the ndx'th entry in the mappings database.
  466.     entries must be a handle to a valid IC mappings database preference.
  467.     ndx must be in the range from 1 to the number of entries in the database.
  468.     The value of pos is ignored on input. pos is set to the position of
  469.     the ndx'th entry in the database and is suitable for passing back
  470.     into ICSetMapEntry.
  471.     Does not return any user data associated with the entry.
  472. */
  473.  
  474. ICError ICGetMapEntry(ICInstance inst,Handle entries,long pos,ICMapEntry* entry);
  475. /*
  476.     Requires IC 1.1.
  477.     You must specify a configuration before calling this routine.
  478.     You do not have to be inside an ICBegin/End pair to call this routine.
  479.     Returns the entry located at position pos in the mappings database.
  480.     entries must be a handle to a valid IC mappings database preference.
  481.     pos should be 0 to get the first entry. To get the subsequent entries, add
  482.     entry.total_size to pos and iterate.
  483.     Does not return any user data associated with the entry.
  484. */
  485.  
  486. ICError ICSetMapEntry(ICInstance inst,Handle entries,long pos,ICMapEntry* entry);
  487. /*
  488.     Requires IC 1.1.
  489.     You must specify a configuration before calling this routine.
  490.     You do not have to be inside an ICBegin/End pair to call this routine.
  491.     Sets the entry located at position pos in the mappings database.
  492.     entries must be a handle to a valid IC mappings database preference.
  493.     pos should be either a value returned from ICGetIndMapEntry or a value
  494.     calculated using ICGetMapEntry.
  495.     entry is a var parameter purely for stack space reasons. It is not
  496.     modified in any way.
  497.     Any user data associated with the entry is unmodified.
  498. */
  499.  
  500. ICError ICDeleteMapEntry(ICInstance inst,Handle entries,long pos);
  501. /*
  502.     Requires IC 1.1.
  503.     You must specify a configuration before calling this routine.
  504.     You do not have to be inside an ICBegin/End pair to call this routine.
  505.     Deletes the mappings database entry at pos.
  506.     entries must be a handle to a valid IC mappings database preference.
  507.     pos should be either a value returned from ICGetIndMapEntry or a value
  508.     calculated using ICGetMapEntry.
  509.     Also deletes any user data associated with the entry.
  510. */
  511.  
  512. ICError ICAddMapEntry(ICInstance inst,Handle entries,ICMapEntry* entry);
  513. /*
  514.     Requires IC 1.1.
  515.     You must specify a configuration before calling this routine.
  516.     You do not have to be inside an ICBegin/End pair to call this routine.
  517.     Adds an entry to the mappings database.
  518.     entries must be a handle to a valid IC mappings database preference.
  519.     The entry is added to the end of the entries database.
  520.     No user data is added.
  521. */
  522. #endif
  523.